home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
qbatb503.zip
/
MIXED.DOC
< prev
next >
Wrap
Text File
|
1991-07-06
|
25KB
|
615 lines
MIXED-LANGUAGE TOOLBOX FOR QuickBASIC
─────────────────────────────────────
By Christy Gemmell
These are native QuickBASIC functions and procedures which call the
machine-code routines in the Assembly-Language Toolbox for QuickBASIC.
To use them, you must link both TOOLBOX.LIB, from the Assembly-Language
Library disk, and the copy of MIXED.LIB from the Mixed-Language Library
disk to your stand-alone programs, like this:
LINK yourprog,,,toolbox.lib mixed.lib;
Since the QuickBASIC environment only allows one Quick Library to be
loaded at a time, however, the version of MIXED.QLB supplied also
contains all the routines from TOOLBOX.LIB. This allows you to use the
environment to develop and test programs which use functions from
both libraries. Just start QuickBASIC with the command:
QB(X) yourprog /L mixed.qlb
You can even build your own Quick Libraries, incorporating Toolbox
routines, using the QuickBASIC Linker as follows:
LINK /QU yoursub.obj yourfun.obj toolbox.lib mixed.lib,,bqlb45.lib;
BQLB45.LIB is the special interface library supplied with Microsoft's
QuickBASIC 4.5 compiler. Substitute the following library names for other
versions of the language.
BQLB40.LIB for QuickBASIC 4.0
BQLB41.LIB for BASIC 6.0
QBXQLB.LIB for BASIC 7.0 and 7.1 PDS
Be sure that, whichever interface library you use, it can be found by
LINK.EXE when the library is being built. This can be done, either by
copying it to the Linker's own directory or to a subdirectory pointed to
by a LIB= environment variable in your AUTOEXEC.BAT file, for example:
SET LIB=C:\QB45\LIBRARY
See your MS-DOS or PC-DOS manual for more information about environment
variables.
If you have the Professional version of the Assembly-Language Toolbox,
of course, building customised libraries is much easier since a full
set of object (.OBJ) modules, together with source code, is supplied
with this release.
The stand-alone (.LIB) and Quick Library (.QLB) versions of the Mixed-
Language Toolbox both contain the following SUB programs and FUNCTION
procedures:
BARMENU
Creates and operates a menu orientated horizontally on the screen row
specified. The calling program must supply :
Row% = The screen row on which the menu bar will appear.
Atr% = The display attribute or colour for the menu bar.
Opt% = Number of options available for selection.
Menu$() = String array containing selection list. Menu$(0) should
be set to a string of ASCII characters, corresponding to
the initial or key letter of each option in the list.
Bar% = The menu selection to be highlighted on entry into the
procedure.
Nxt% = If set, this flag just causes the menu to be refreshed
without pausing for a selection from the user. This is
used to handle presses on the Right or Left Arrow keys
in the Pull-Down Menu procedure.
Ctx% = If set, this flag indicates that context-sensitive help
is available, in which case ...
Tpc$ = The root name of the Topic file to be displayed if the
user presses <F1> for help. The current selection number
is appended to this to produce the actual filename.
Mouse% = If set, this flag indicates that a mouse is installed
and can be used to make selections.
On completion the procedure returns with the following variable set:
Bar% = Number of selection made by user. If zero then the
<Escape> key was pressed to abort the procedure
without making a selection.
DECLARE SUB BarMenu (Row%, Atr%, Opt%, Menu$(), Bar%, Nxt%,_
Ctx%, Topic$, Mouse%)
See the source code for DEMON.BAS, the Toolbox demonstration program, for
an example of BARMENU in use.
BINDEC
Translates a string of binary digits to their long integer decimal
equivalent.
DECLARE FUNCTION BinDec& (Binary$)
BITRESET
Clears the specified bit (0-15) of the integer number supplied.
DECLARE SUB BitReSet (Number%, Bit%)
BITSET
Sets the specified bit (0-15) in the integer number supplied to 1.
DECLARE SUB BitSet (Number%, Bit%)
BITTEST
Returns logical TRUE (-1) if the bit (0-15) of Number% is set and FALSE
(zero) if the bit is clear.
DECLARE FUNCTION BitTest% (Number%, Bit%)
CENTRE
Centres the string supplied within an empty string of specified width.
DECLARE FUNCTION Centre$ (Text$, MaxWidth%)
This function is called by the VERMENU routine (see below) to centre the
title of a pull-down menu within the window it refers to.
CHECKPRINTER
This procedure checks if the specified parallel printer is ready and
on-line. If so, it returns immediately with Ready% set to -1 (TRUE), if
not, CHECKPRINTER displays the message 'PRINTER NOT READY' on the bottom
row of the screen and waits for the operator to correct the problem and
press a key.
If the user presses <Escape>, the procedure returns with Ready% set to
zero (FALSE). Any other keystroke causes it to go back and test the
printer again. CHECKPRINTER will not return until either the printer is
ready for output, or the <Escape> key is pressed.
DECLARE SUB CheckPrinter (Printer%, Ready%)
Printer% is the number of the parallel printer to test (1 = LPT1: etc).
Example: CheckPrinter 1, Ready% ' Test LPT1:
IF NOT Ready% THEN
STOP
ELSE
LPRINT Stuff$
END IF
DATEINPUT
Accepts and verifies date input in a Reverse Video entry panel, all the
usual editing keys are supported and entry is terminated by either a
Carriage Return or one of several special function keys (see below).
DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
Default$ = default string which can be accepted by just pressing
the <Enter> key.
Context% = set TRUE if context-sensitive help is available, in
which case ...
Topic$ = name of the HELP Topic file to display whenever the
<F1> key is pressed.
HotKey% = If entry is terminated by anything other than the
<Enter> key, this variable will contain an explanatory
return code ..
Return Codes: 1 = <Escape> abort entry returning a null string
2 = <F2> repeat previous entry for this field
3 = <Up Arr> pressed, move to previous field
4 = <Dn Arr> pressed, move to next field
5 = <Pg Up> pressed, move to top of screen
6 = <Pg Dn> pressed, move to end of screen
Editing Keys: <L.Arrow> = Move cursor one character to the left
<R.Arrow> = Move cursor one character to the right
<Home> = Move cursor to first character of field
<End> = Move cursor to last character of field
<Ctrl End> = Clear from current cursor position to
the end of the entry field.
<BackSpace> = Replace character under cursor with a
blank space and move cursor one character
to the left.
<F1> = pop up on-line HELP screen.
DATEINPUT is designed to be used as part of a full-screen data-entry
system. Your program can examine the return code to determine whether
the operator wishes to terminate entry or move forwards or backwards
between entry fields.
See also the REVINPUT function for a similar, more general-purpose,
data-entry routine.
DAYSBETWEEN
Calculates the number of days between two dates, supplied as strings in
the format DD/MM/YYYY. The function will provide accurate results when
supplied with dates between 01/01/1901 and 31/12/2099.
DECLARE FUNCTION DaysBetween& (Date1$, Date2$)
See the INT